const Router = require('koa-router')
//

const { create, update, get, list, del } = require('../controller/project')

const {
  createValidator,
  updateValidator,
  delValidator,
  listValidator,
  getValidator,
} = require('../middleware/validator/project')

const { validateToken } = require('../middleware/auth/token')

const PREFIX = '/v1/project'

const router = new Router({ prefix: PREFIX })

router.get('/get', validateToken, getValidator, get)

router.put('/update', validateToken, updateValidator, update)

// 后端管理员权限
router.post('/create', validateToken, createValidator, create)

// 后端管理员权限
router.del('/del', validateToken, delValidator, del)

// 后端管理员权限
router.get('/list', validateToken, listValidator, list)

module.exports = router
